package sdk

// 查询商品可用库存请求
type ItemQueryStockRequest struct {
	*BaseRequest
	DeliverCode string `json:"deliverCode"` // 发货编码: 必填
}

//
func (request *ItemQueryStockRequest) GetMethod() (method string) {
	return "/item/queryStock"
}

//
func CreateItemQueryStockRequest() (request *ItemQueryStockRequest) {
	request = &ItemQueryStockRequest{
		BaseRequest: &BaseRequest{},
	}
	return
}

// 查询商品可用库存响应
type ItemQueryStockResponse struct {
	*BaseResponse
	Data ItemQueryStockData `json:"data,omitempty"`
}

//
type ItemQueryStockData struct {
	DeliverAreaId   int64  `json:"deliverAreaId,omitempty"`   // 发货地编号
	DeliverAreaName string `json:"deliverAreaName,omitempty"` // 发货地名称
	DeliverCode     string `json:"deliverCode,omitempty"`     // 货编码
	AvailableCount  int    `json:"availableCount,omitempty"`  // 可用库存
}

// 查询商品可用库存
func (client *Client) ItemQueryStock(request *ItemQueryStockRequest) (response *ItemQueryStockResponse, err error) {
	response = &ItemQueryStockResponse{
		BaseResponse: &BaseResponse{},
	}
	err = client.DoAction(request, response)
	return
}
